package com.klikmee.sms.core.base.dao;

import javax.persistence.NoResultException;

import com.klikmee.sms.core.model.BulkMessage;

public class BulkMessageDAO extends AbstractDAO<BulkMessage> {
	public BulkMessageDAO() {
		super( BulkMessage.class );
	}

	public BulkMessage findByProvidersIdAndProviderName(String providersMessageId, String providerName) {
		try {
			BulkMessage bulkMessage = (BulkMessage) entityManager
					.createNamedQuery( "BulkMessage.findByProvidersIdAndName" )
					.setParameter( "prividersId", providersMessageId )
					.setParameter( "providerName", providerName )
					.getSingleResult();
			return bulkMessage;
		}
		catch (NoResultException e) {
			return null;
		}
	}
}
